﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="admin_title_modify.aspx.cs" Inherits="skvote.admin_title_modify" %>

<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<%skvote.function.header(Response);%>
<title>【单考投票系统】后台管理中心</title>
</head>
<script language="javascript">
function check(){
	if(form1.sid.selectedIndex==-1){
		lblsubject.innerHTML = "所属主题不能为空！";
		form1.sid.focus();
		return false;}
	else{
		lblsubject.innerHTML = "";}	
	if(form1.title.value==""){
		lbltitle.innerHTML = "投票问题不能为空！";
		form1.title.focus();
		return false;}	
	else{
		lbltitle.innerHTML = "";}	
	return true;
	}
</script>
<body>
<table border="0" cellpadding="1" cellspacing="2" width="100%" id="table1" bgcolor="#E1F0FF">
  <tr>
    <td>
	   <table width="100%" id="table2" cellspacing="1">
	     <tr>
          <td id="TableTitle1"> 修改投票问题-&gt;</td>
		 </tr>
	   </table>
	</td>
  </tr>
  <tr>
    <td><table border="1" cellpadding="4" cellspacing="0" width="100%" id="table2" bordercolor="#BFDFFF">
        <form action="" method="post" name="form1" onsubmit="return check()" runat="server">
          <tr id="TableTitle2">
            <td width="20%" align="right">所属主题名称：</td>            
            <td><select name="sid" id="sid">
              <%
                if (!string.IsNullOrEmpty(Request["id"]) && !string.IsNullOrEmpty(Request["sid"]))
                {
                    OleDbConnection connection = new skvote.conn().CreateConnection();
                    try
                    {
                        OleDbCommand cmd = new OleDbCommand("select id,subject from xh_subject",connection);
                        OleDbDataReader dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            if (dr["id"].ToString().Trim() == Request["sid"].Trim())
                            {
                                Response.Write("<option value='" + dr["id"].ToString() + "' selected>" + dr["subject"] + "</option>");
                            }
                            else
                            {
                                Response.Write("<option value='" + dr["id"].ToString() + "'>" + dr["subject"] + "</option>");
                            }                            
                        }
                        dr.Close();
                        cmd.Dispose();
                    }
                    finally
                    {
                        connection.Close();
                    }
                }
             %>
              </select>
            </td>
          </tr>
          <tr>
            <td width="20%" align="right">投票问题名称：</td>
            <td><input type="text" name="title" size="25" id="title" value="<%=title(Request["id"])%>"></td>
          </tr>
          <tr>
            <td width="20%" align="right">投票类型：</td>
            <td><select name="ms" size="1" id="ms">
                <option value="1" <%=ms(Request["id"],"1")%> > 单选</option>
                <option value="2" <%=ms(Request["id"],"2")%>> 多选</option>
              </select></td>
          </tr>
          <tr>
            <td width="20%" align="right">列表类型：</td>
            <td><select size="1" name="listType" id="listType">
                <option value="0" <%=ListType(Request["id"],"1")%> >文本</option>
                <option value="1" <%=ListType(Request["id"],"1")%>>图片</option>
              </select></td>
          </tr>	
          <tr>
            <td width="20%" align="right">每行排列数：</td>
            <td><select size="1" name="listRows" id="listRows">
              <%ListRows(Request["id"]);%>
              </select></td>
          </tr>	
          <tr>
            <td colspan="2" align="center" bgcolor="#BFDFFF"><asp:Button ID="submit" Text="修改" 
                    runat="server" class="btn" onclick="submit_Click" /></td>
          </tr>
        </form>
      </table></td>
  </tr>
</table>
</body>

</html>
